/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.acap.googlemaps.encapsulados;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Malkavian
 */
@Entity
@Table(name = "tipocoordenada")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tipocoordenada.findAll", query = "SELECT t FROM Tipocoordenada t"),
    @NamedQuery(name = "Tipocoordenada.findById", query = "SELECT t FROM Tipocoordenada t WHERE t.id = :id"),
    @NamedQuery(name = "Tipocoordenada.findByNombreTipo", query = "SELECT t FROM Tipocoordenada t WHERE t.nombreTipo = :nombreTipo")})
public class Tipocoordenada implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nombreTipo")
    private String nombreTipo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipo")
    private List<Coordenadas> coordenadasList;
    @JoinColumn(name = "icono", referencedColumnName = "idiconos")
    @ManyToOne(optional = false)
    private Iconos icono;

    public Tipocoordenada() {
    }

    public Tipocoordenada(Integer id) {
        this.id = id;
    }

    public Tipocoordenada(Integer id, String nombreTipo) {
        this.id = id;
        this.nombreTipo = nombreTipo;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombreTipo() {
        return nombreTipo;
    }

    public void setNombreTipo(String nombreTipo) {
        this.nombreTipo = nombreTipo;
    }

    @XmlTransient
    public List<Coordenadas> getCoordenadasList() {
        return coordenadasList;
    }

    public void setCoordenadasList(List<Coordenadas> coordenadasList) {
        this.coordenadasList = coordenadasList;
    }

    public Iconos getIcono() {
        return icono;
    }

    public void setIcono(Iconos icono) {
        this.icono = icono;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tipocoordenada)) {
            return false;
        }
        Tipocoordenada other = (Tipocoordenada) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.acap.googlemaps.encapsulados.Tipocoordenada[ id=" + id + " ]";
    }
    
}
